home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Comm / yam / kmailtombox.lha / kmailtombox
Text File  |  2004-06-22  |  2KB  |  75 lines

  1. /* Kmail to MBOX Arexx Script V1.0
  2.     Specify path of Kmail's messages (blank assumes current) (Don't put the trailing /)
  3.     a file called MBOX will be placed in the directory where this is run from
  4.     It will process all files in that directory as if they were messages (so remove files that aren't)
  5.     Written by: Arthur D. Moyer (lordart@lbpsinc.com)
  6.     Disclaimer:  Worked for me for what I was using it for, and YAM didn't seem to have an issue!
  7.                  Hopefully it will do the same for you!  :)
  8. */
  9.  
  10.  
  11. parse arg mpath
  12. address command
  13.  
  14. 'list >t:mbox quick sort name 'mpath
  15.  
  16. i=1
  17.  
  18. if exists('t:mbox') then DO
  19.     l=open(mlist,'t:mbox','R')
  20.     if ((right(mpath,1)~=':') & (right(mpath,1)~="/")) THEN mpath=mpath||'/'
  21.     l=open(mbox,'mbox','W')
  22.     DO FOREVER
  23.         ln=readln(mlist)
  24.         if (index(ln,' blocks used')>0) then break
  25.         say '#'i' filename being processed: 'ln
  26.         i=i+1
  27.         l=open(mfile,mpath||ln,'R')
  28.         finfo=''
  29.         dinfo=''
  30.         DO WHILE EOF(mfile)=0
  31.             mln=readln(mfile)
  32.             if (index(mln,'From:')>0) THEN finfo=mln
  33.             if (index(mln,'Date:')>0) THEN dinfo=mln
  34.             if (finfo~='') & (dinfo~='') THEN break
  35.         END
  36.         /*say finfo'  'dinfo*/
  37.         if ((index(finfo,'<')>0) & (index(finfo,'>')>0)) THEN DO
  38.             s=index(finfo,'<')
  39.             e=index(finfo,'>')
  40.             parse var finfo '<' fout '>' fr
  41.             END
  42.         else DO
  43.             parse var finfo 'From: ' fout
  44.         END
  45.  
  46.         if (index(dinfo,',')=0) THEN DO
  47.             parse var dinfo dhd dcal dmon dyear dtime dzone
  48.             dday='Sat'
  49.             END
  50.         else DO
  51.             parse var dinfo dhd dday dcal dmon dyear dtime dzone
  52.             parse var dday dday ','
  53.         END
  54.         /*say dday' 'dcal' 'dmon' 'dyear' 'dtime' 'dzone*/
  55.         dout=dday' 'dmon' 'right('  'dcal,2)' 'dtime' 'dyear
  56.         /*say dout' 'length(dout)*/
  57.         l=seek(mfile,0,'B')
  58.         l=writeln(mbox,'From 'fout' 'dout)
  59.         do while (EOF(mfile)=0)
  60.             mln=readln(mfile)
  61.             if (left(mln,5)='From ') THEN mln='>'mln
  62.             l=writeln(mbox,mln)
  63.         end
  64.         l=writeln(mbox,'')
  65.         l=close(mfile)
  66.     END
  67.     l=close(mlist)
  68.     l=close(mbox)
  69.     say''
  70.     say'MBox processing completed.  Mbox File Created.'
  71. END
  72.  
  73. 'delete >nil: t:mbox'
  74.  
  75.